/**
   *************************(C) COPYRIGHT 2020 LionHeart*************************
   * @file        power_task.c           
   * @brief                                                                      
   *                                       
   * @note 
   * @history  
   *  Version    Date              Author          Modification                   
   *  V1.0.0     2021 11 23        yanfubing       1. done
   *@verbatim
   ==============================================================================
   relay:
   ==============================================================================
   @endverbatim
   *************************(C) COPYRIGHT 2020 LionHeart*************************
   */

#include "power_control.h"
/**
  * @brief          Power*4任务
  * @param[in]      开启Power*4
  * @retval         none
  */
void power_Init(void)
{
	power_open(1);
	power_open(2);
	power_open(3);
	power_open(4);
}

/**
  * @brief          Power*4任务
  * @param[in]      开启Power
  * @retval         none
  */
void power_off(uint8_t i)
{
		switch(i)
		{
			case 1:
			{
				 HAL_GPIO_WritePin(open_12v_GPIO_Port,open_12v_Pin,GPIO_PIN_RESET);
			}break;
			case 2:
			{
				 HAL_GPIO_WritePin(open_12v_2_GPIO_Port, open_12v_2_Pin,GPIO_PIN_RESET);
			}break;
			case 3:
			{
				 HAL_GPIO_WritePin(Open_24v_GPIO_Port,open_12v_Pin,GPIO_PIN_RESET);
			}break;
			 case 4:
			{
				 HAL_GPIO_WritePin(open_24v_2_GPIO_Port,open_24v_2_Pin,GPIO_PIN_RESET);
			}break;
		}
}

/**
  * @brief          Power*4任务
  * @param[in]      关闭Power
  * @retval         none
  */
void power_open(uint8_t i)
{
	switch (i)
	{
		case 1:
		{
			HAL_GPIO_WritePin(open_12v_GPIO_Port, open_12v_Pin, GPIO_PIN_SET);
		}break;
		case 2:
		{
			HAL_GPIO_WritePin(open_12v_2_GPIO_Port, open_12v_2_Pin, GPIO_PIN_SET);
		}break;
		case 3:
		{
			HAL_GPIO_WritePin(Open_24v_GPIO_Port, open_12v_Pin, GPIO_PIN_SET);
		}break;
		case 4:
		{
			HAL_GPIO_WritePin(open_24v_2_GPIO_Port, open_24v_2_Pin, GPIO_PIN_SET);
		}break;
	}
}




